function GetXmlHttpObject(handler)
{
  var objXMLHttp=null
  if (window.XMLHttpRequest)
  {
      objXMLHttp=new XMLHttpRequest()
  }
  else if (window.ActiveXObject)
  {
      objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
  return objXMLHttp
}

function stateChanged()
{
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  {
 
 // txtResult will be filled with new page
         document.getElementById("txtResult").innerHTML = xmlHttp.responseText
		 //window.location.reload();
  }
  else {
          //alert(xmlHttp.status);
  }
}

function addtofav(stype,id,mid,url)
{
	if(mid=="")
	{
		window.location.href=url+"pls_register.php";
		}
		else
		{
//	alert("ss");
url= url+"addtofav.php";
	//alert(qStr+"--"+status);
  if (url.length==0)
  {
      document.getElementById("txtResult").innerHTML = "";
      return;
  }

  xmlHttp = GetXmlHttpObject();

  if (xmlHttp==null)
  {
      alert ("Browser does not support HTTP Request");
      return;
  }

  url=url+"?stype="+stype+"&id="+id+"&mid="+mid;
  url=url+"&sid="+Math.random();
 
  xmlHttp.onreadystatechange = stateChanged;
  xmlHttp.open("GET",url,true) ;
  xmlHttp.send(null);
		}
}
+7
